package com.zhou.blog.handler;

import com.zhou.blog.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @title:AllExceptionHandler
 * @Author Zhou
 * @Date:2022/4/19 21:59
 * @Version 1.0
 */
//拦截加了controller注解的方法
@ControllerAdvice
public class AllExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result doException(Exception ex){
        ex.printStackTrace();
        return Result.fail(-999,"系统异常");
    }
}